package LC;

/**
 * @ClassName LC.LC378
 * @Description: TODO
 * @Author hl
 * @Date 2020/5/20
 * @Version V1.0
 **/
public class LC378 {
    public static void main(String[] args) {
        int []arr={1,2,3,4,5,6,7};
        for(int i=0;i<arr.length&&arr[i]%2==0;i++){
            System.out.println("111");
        }

    }
    public static int kthSmallest(int[][] matrix, int k) {
        int row=matrix.length;
        int column=matrix[0].length;
        int left=matrix[0][0];
        int right=matrix[row-1][column-1];
        while(left<right){
            int mid=(left+right)/2;
            //统计次数
            int count=findCount(mid,row,column,matrix);
            if(count<k){
                left=mid+1;
            }else{
                right=mid;
            }


        }
        return right;

    }

    private static int findCount(int mid,int row,int column,int [][]matrix) {
        int count=0;
        int i=row-1;
        int j=0;
        while(i>=0&&j<column){
            if(matrix[i][j]<=mid){
                count+=i+1;
                j++;
            }else{
                i--;
            }
        }
        return count;
    }

}
